import request from "@/libs/request";

const basePath = "/appcloud-data";
const headPath = "/appcloud-resource";

export const apiUrls = {
  getShareStorePage: headPath + "/api/share/getShareStorePage",
  createFile: headPath + "/api/share/createFile",
  getShareDetail: headPath + "/api/share/get/",
  getFileByName: basePath + "/api/share/getFileByName",
  removeFile: headPath + "/api/share/removeFile",
  getFileFirstList: headPath + "/api/share/getFileFirstList/",
  getFileDetailList: headPath + "/api/share/getFileDirList",
  getDirFile : headPath + "/api/share/getDirFile",
  syncFile : headPath + '/api/share/syncFile'
};
// 获取共享存储列表
export async function getShareStorePage(params) {
  return request(apiUrls.getShareStorePage, {
    method: "POST",
    body: params
  });
}
// 创建文件夹或文件
export async function createFile(params) {
  return request(apiUrls.createFile, {
    method: "POST",
    body: params
  });
}
//获取共享存储详情
export async function getShareDetail(params) {
  return request(apiUrls.getShareDetail + `${params.id}`, {
    method: "POST",
    body: params
  });
}
//判断文件夹是否存在
export async function getFileByName(params) {
  return request(apiUrls.getFileByName, {
    method: "POST",
    body: params
  });
}
//删除文件
export async function removeFile(params) {
    return request(apiUrls.removeFile,{
        method:'POST',
        body:params
    })
}
//获取盘符一级文件列表
export async function getFileFirstList(params) {
    return request(apiUrls.getFileFirstList + `${params.id}`,{
        method:'POST',
        body:params
    })
}
//获取文件详情列表
export async function getFileDetailList(params) {
    return request(apiUrls.getFileDetailList,{
        method:'POST',
        body:params
    })
}

//获取指定共享目录文件
export async function getDirFile() {
  return request(apiUrls.getDirFile,{
      method:'POST',
  })
}


//同步文件
export async function syncFile(params) {
  return request(apiUrls.syncFile,{
      method:'POST',
      body:params
  })
}